<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>添加管理员</title>
		<link rel="stylesheet" href="/adminSite/css/X-ui.css" />
		<style>
			.textarea{
				margin-top:-1px;
			}
		</style>
	</head>
	<body>
		<div class="pd-20">
			<ol class="breadcrumb-nav">
				<li>
					<a href="">主页</a>
				</li>
				<li>
					<a href="">管理员列表</a>
				</li>
				<li>
					添加管理员
				</li>
			</ol>
			<form class="x-ui-form form col-10 col-offset-1">
				<!--昵称-->
				<div class="row cl">
					<label class="form-label col-2">管理员昵称:</label>
					<div class="col-10">
						<input type="text" name="nickname" required class="input-text"/>
					</div>
				</div>
				<!--账号-->
				<div class="row cl">
					<label class="form-label col-2">账号:</label>
					<div class="col-10">
						<input type="text" name="account" required class="input-text"/>
					</div>
				</div>
				<!--密码-->
				<div class="row cl">
					<label class="form-label col-2">密码:</label>
					<div class="col-10">
						<input type="password" name="password" required class="input-text"/>
					</div>
				</div>
				<!--确认密码-->
				<div class="row cl">
					<label class="form-label col-2">确认密码:</label>
					<div class="col-10">
						<input type="password" name="confirmPassword" required class="input-text"/>
					</div>
				</div>
				<!--备注-->
				<div class="row cl">
					<label class="form-label col-12 text-l">备注:</label>
					<div class="col-12">
						<textarea class="textarea" name="remarks" required></textarea>
					</div>
				</div>
				<div class="btn btn-submit">保存</div>
			</form>
		</div>
		<script type="text/javascript" src="/adminSite/js/jquery-1.11.0.js" ></script>
		<script type="text/javascript" src="/adminSite/js/extend/X-ui-modal/js/X-ui-modal.js" ></script>
		<script type="text/javascript" src="/adminSite/js/H-ui-form.js" ></script>
		<script>
			$(function(){
				var form = new XuiForm();
				form.verification(".form" , ".btn-submit" , {
					account : {max : 20,min : 6},
					password : {max : 20,min : 6},
					confirmPassword : {max : 20,min : 6},
					nickname : {max : 20,min : 2},
					remarks : {max : 20,min : 2}
				},{
					account : {
						empty : "账号不能为空",
						min : "账号不能少于6个字",
						max : "账号最多20个字"
					},
					password : {
						empty : "密码不能为空",
						min : "密码不能少于6个字",
						max : "密码最多20个字"
					},
					confirmPassword : {
						empty : "确认密码不能为空",
						min : "确认密码不能少于6个字",
						max : "确认密码最多20个字"
					},
					nickname : {
						empty : "昵称不能为空",
						min : "昵称不能少于2个字",
						max : "昵称最多20个字"
					},
					remarks : {
						empty : "简介不能为空",
						min : "简介不能少于2个字",
						max : "简介最多20个字"
					},
				},function(data){
					$.post("/admin/addUser" , data , function(data){
						console.log(data);
						if(data.state == "ok"){
							XuiModal().msg("添加成功!",{icon:4});
						}else{
							XuiModal().msg(data.message , {icon:2});
						}
					},"JSON")
				},true);
			})
		</script>
	</body>
</html>
